package com.eduction.modules.system.dao;

import java.sql.SQLException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.eduction.common.dbutil.DbHelper;
import com.eduction.modules.system.entity.SysValue;

@Repository
public class SysValueRepository {

	@Autowired
	private DbHelper dbHelper;
	@Autowired
	private SysValueDao sysValueDao;
	/**
	 * 根据pid获取参数值
	 * @param type
	 * @return
	 * @throws SQLException
	 */
	public SysValue getSysValue(String pid) throws SQLException{
		String sql = "SELECT t.p_id as pid,t.sys_value as sysvalue,t.remark as remark " +
				" FROM t_sys_value t WHERE t.p_id =?";
		SysValue asv = dbHelper.getBean(sql, SysValue.class,pid);
		return asv;
	}
	
	/**
	 * 修改系统参数
	 * @param asv
	 * @throws SQLException
	 */
	public void updateSysValue(SysValue asv) throws SQLException{
		if(asv!=null)
			sysValueDao.save(asv);
	}
}
